//2009/08/30 20:52:45
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class GroupedWordChecker
{
public:
    int howMany(vector <string> words)
    {
        int ret = 0;
        for (int i=0; i<words.size(); i++)
            if (isgrouped(words[i]))
                ret ++;
        return ret;
    }
    bool isgrouped(string s)
    {
        vector<bool> v(26, true);
        v[s[0]-'a'] = false;
        for (int i=1; i<s.size(); i++)
            if (s[i] != s[i-1])
            {
                if (v[s[i] - 'a'] == false)
                    return false;
                else
                    v[s[i] - 'a'] = false;
            }
        return true;
    }
};
